package com.ohc.leetcode.字符串;

/**
 * @Author 欧皓辰
 * @Date 2021/12/28 22:23
 * @Version 1.0
 * https://leetcode-cn.com/problems/ti-huan-kong-ge-lcof/
 */
public class 替换空格 {

    public static void main(String[] args) {
        String s = "We are happy.";
//        s.replace()
        char[] chars = s.toCharArray();
        for (int i = 0; i < chars.length; i++) {
            if (chars[i] == ' ') {
                chars[i] = '+';
            }
        }
        for (int i = 0; i < chars.length; i++) {
            System.out.println("chars[i] = " + chars[i]);
        }

    }
}
